/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author LYS
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface BasPkgM extends BasicModel<BasPkgM> {
  ccode?: string; // 产品代号
  cname?: string; // 包装名称
  invCode?: string; // 存货编码
  iqty?: number; // 容量
  barType?: string; // 条码类型
  bbind?: string; // 是否需要绑定
  blink?: string; // 是否验真
  floatRatio?: string; // 打印张数上浮比例
  exportType?: string; // 导出类型
  barSize?: string; // 导出二维码尺寸
  fromUrl?: string; // 追溯地址
  basPkgCList?: any[]; // 子表列表
}

export const basPkgMList = (params?: BasPkgM | any) =>
  defHttp.get<BasPkgM>({ url: adminPath + '/pkg/basPkgM/list', params });

export const basPkgMListData = (params?: BasPkgM | any) =>
  defHttp.post<Page<BasPkgM>>({ url: adminPath + '/pkg/basPkgM/listData', params });

export const basPkgMForm = (params?: BasPkgM | any) =>
  defHttp.get<BasPkgM>({ url: adminPath + '/pkg/basPkgM/form', params });

export const basPkgMSave = (params?: any, data?: BasPkgM | any) =>
  defHttp.postJson<BasPkgM>({ url: adminPath + '/pkg/basPkgM/save', params, data });

export const basPkgMImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/pkg/basPkgM/importData',
      onUploadProgress,
    },
    params,
  );

export const basPkgMDisable = (params?: BasPkgM | any) =>
  defHttp.get<BasPkgM>({ url: adminPath + '/pkg/basPkgM/disable', params });

export const basPkgMEnable = (params?: BasPkgM | any) =>
  defHttp.get<BasPkgM>({ url: adminPath + '/pkg/basPkgM/enable', params });

export const basPkgMDelete = (params?: BasPkgM | any) =>
  defHttp.get<BasPkgM>({ url: adminPath + '/pkg/basPkgM/delete', params });

export const basPkgMGetGenPkgInfo = (params?: BasPkgM | any) =>
  defHttp.get<BasPkgM>({ url: adminPath + '/pkg/basPkgM/getGenPkgInfo', params });
